#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
using namespace std;
const int N=8000+10,M=2e5+10;
int n,m,opt,x,v,ans;
int a[N];
int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1; i<=n; ++i)
		scanf("%d",&a[i]);
	for(int i=1; i<=m; ++i)
	{
		scanf("%d",&opt);
		if(opt==1)
		{
			scanf("%d%d",&x,&v);
			a[x]=v;
		}
		else
		{
			scanf("%d",&x);
			ans=0;
			for(int i=1; i<x; ++i)
				if(a[i]<=a[x])++ans;
			for(int i=x+1; i<=n; ++i)
				if(a[i]<a[x])++ans;
			printf("%d\n",ans+1);
		}
	}
	return 0;
}
